package com.sd.repay.service;


import com.sd.repay.common.Page;
import com.sd.repay.pojo.ProfitDetail;

import java.util.List;
import java.util.Map;

/**
 * @author
 * @Description:
 * @date 2017年10月25日
 */
public interface ProfitDetailService {

    /**
     * 保存收益记录
     *
     * @param detail
     * @return
     * @throws Exception
     */
    int saveProfitDetail(ProfitDetail detail) throws Exception;

    /**
     * 根据类型及业务订单号查询是否存在收益记录
     *
     * @param profitMerType
     * @param profitMerNo
     * @param serviceType
     * @param serviceOrderNo
     * @return
     * @throws Exception
     */
    ProfitDetail getProfitDetailByProfitMerAndService(String profitMerType, String profitMerNo, String serviceType, String serviceOrderNo) throws Exception;

    /**
     * 修改收益入账状态
     *
     * @param profitNo
     * @return
     * @throws Exception
     */
    int updateIncomeStatus(String profitNo) throws Exception;

    /**
     * 获取商户总收益金额
     *
     * @param merType
     * @param merNo
     * @return
     * @throws Exception
     */
    String getTotalProfitAmountByMer(String merType, String merNo) throws Exception;

    /**
     * 获取商户可提现金额和冻结金额
     *
     * @param merType
     * @param merNo
     * @return currBalance：可提现金额（今日余额加历史余额）；freezeBalance：冻结金额
     * @throws Exception
     */
    Map<String, String> getMerTypeBalance(String merType, String merNo) throws Exception;

    /**
     * 获取商户所有收益明细
     *
     * @param merType
     * @param merNo
     * @throws Exception
     */
    List<ProfitDetail> getProfitDetailByMer(String merType, String merNo) throws Exception;

    Page<ProfitDetail> getProfitDetailPageByMer(String merType, String merNo, String startTime, String endTime, int pageNo, int pageSize) throws Exception;

    List<ProfitDetail> getUnIncomeProfitDetail() throws Exception;

}
